package edu.cmu.abi;

import edu.cmu.abi.track.Track;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.logging.Level;
import java.util.logging.Logger;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
/**
 *
 * @author SimplyYogi
 */
public class MusicEngine {

    public static void main(String[] args) {

        Connection connection = null;

        try {
            //System.setProperty("java.library.path", "C:\\hdf-java\\lib\\win");
            //System.out.println(System.getProperty("java.library.path"));
            //System.loadLibrary("jhdf5");


            String driverName = "oracle.jdbc.driver.OracleDriver";
            Class.forName(driverName);
            String serverName = "localhost";
            String portNumber = "1521";
            String sid = "XE";
            String url = "jdbc:oracle:thin:@" + serverName + ":" + portNumber + ":" + sid;
            String username = "MSD";
            String password = "johnheinz";
            connection = DriverManager.getConnection(url, username, password);
            System.out.println("Built connection");

//            BufferedReader stdIn = new BufferedReader(new InputStreamReader(System.in));
//            System.out.println("Please enter the artist name:");
//            String artistname = stdIn.readLine();
//
//            Artist artistA = new Artist();
//            artistA.read(artistname, connection);

            //ArrayList<Artist> similarArtists = Artist.readSimilarArtists(artistname, connection);

            //Track trackA = new Track("C:\\Users\\SimplyYogi\\Documents\\NetBeansProjects\\MSD\\trunk\\src\\data\\","TRAAAAW128F429D538");
            //trackA.loadCharacteristics();
            //Track trackB = new Track("TRHSFCM128F9311151");
            //trackB.loadCharacteristics();

            Track.printCharacteristics(connection);


            //Track B is set to song called Bird
            //Track trackB = new Track("F:/MillionSong/Extracted/N/U/D/", "TRNUDQC128F1457E77.h5");
            //trackB.loadCharacteristics();
            //double cosineScore = SimilarityCalculator.calcCosine(trackA, trackB);
            //System.out.println("Similarity score:" + cosineScore);

        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        } catch (SQLException e) {
            e.printStackTrace();
        } catch (Exception ex) {
            Logger.getLogger(MusicEngine.class.getName()).log(Level.SEVERE, null, ex);
        }

    }
}
